home *** CD-ROM | disk | FTP | other *** search
/ This Disc Bytes! / Power Computing - The Disc 2 - This Disc Bytes.ISO / mac / CodeWarrior 7 Lite for 68K / MacOS Support / Headers / Universal Headers / Printing.h < prev    next >
Text File  |  1995-07-06  |  14KB  |  473 lines

  1. /*
  2.      File:        Printing.h
  3.  
  4.      Contains:    Print Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __PRINTING__
  21. #define __PRINTING__
  22.  
  23.  
  24. #ifndef __ERRORS__
  25. #include <Errors.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __QUICKDRAW__
  30. #include <Quickdraw.h>
  31. #endif
  32. /*    #include <Types.h>                                            */
  33. /*    #include <MixedMode.h>                                        */
  34. /*    #include <QuickdrawText.h>                                    */
  35.  
  36. #ifndef __DIALOGS__
  37. #include <Dialogs.h>
  38. #endif
  39. /*    #include <Memory.h>                                            */
  40. /*    #include <Menus.h>                                            */
  41. /*    #include <Controls.h>                                        */
  42. /*    #include <Windows.h>                                        */
  43. /*        #include <Events.h>                                        */
  44. /*            #include <OSUtils.h>                                */
  45. /*    #include <TextEdit.h>                                        */
  46.  
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50.  
  51. #if PRAGMA_ALIGN_SUPPORTED
  52. #pragma options align=mac68k
  53. #endif
  54.  
  55. #if PRAGMA_IMPORT_SUPPORTED
  56. #pragma import on
  57. #endif
  58.  
  59.  
  60. enum {
  61.     iPFMaxPgs                    = 128,
  62.     iPrPgFract                    = 120,                            /*Page scale factor. ptPgSize (below) is in units of 1/iPrPgFract*/
  63.     iPrPgFst                    = 1,                            /*Page range constants*/
  64.     iPrPgMax                    = 9999,
  65.     iPrRelease                    = 3,                            /*Current version number of the code.*/
  66.     iPrSavPFil                    = -1,
  67.     iPrAbort                    = 0x0080,
  68.     iPrDevCtl                    = 7,                            /*The PrDevCtl Proc's ctl number*/
  69.     lPrReset                    = 0x00010000,                    /*The PrDevCtl Proc's CParam for reset*/
  70.     lPrLineFeed                    = 0x00030000,
  71.     lPrLFStd                    = 0x0003FFFF,                    /*The PrDevCtl Proc's CParam for std paper advance*/
  72.     lPrLFSixth                    = 0x0003FFFF,
  73.     lPrPageEnd                    = 0x00020000,                    /*The PrDevCtl Proc's CParam for end page*/
  74.     lPrDocOpen                    = 0x00010000,
  75.     lPrPageOpen                    = 0x00040000,
  76.     lPrPageClose                = 0x00020000,
  77.     lPrDocClose                    = 0x00050000,
  78.     iFMgrCtl                    = 8,                            /*The FMgr's Tail-hook Proc's ctl number*/
  79.     iMscCtl                        = 9,                            /*The FMgr's Tail-hook Proc's ctl number*/
  80.     iPvtCtl                        = 10                            /*The FMgr's Tail-hook Proc's ctl number*/
  81. };
  82.  
  83. #define sPrDrvr ".Print"
  84. enum {
  85.     pPrGlobals                    = 0x00000944,                    /*The PrVars lo mem area:*/
  86.     bDraftLoop                    = 0,
  87.     bSpoolLoop                    = 1,
  88.     bUser1Loop                    = 2,
  89.     bUser2Loop                    = 3,
  90.     fNewRunBit                    = 2,
  91.     fHiResOK                    = 3,
  92.     fWeOpenedRF                    = 4,
  93. /*Driver constants */
  94.     iPrBitsCtl                    = 4,
  95.     lScreenBits                    = 0,
  96.     lPaintBits                    = 1,
  97.     lHiScreenBits                = 0x00000002,                    /*The Bitmap Print Proc's Screen Bitmap param*/
  98.     lHiPaintBits                = 0x00000003,                    /*The Bitmap Print Proc's Paint [sq pix] param*/
  99.     iPrIOCtl                    = 5,
  100.     iPrEvtCtl                    = 6,                            /*The PrEvent Proc's ctl number*/
  101.     lPrEvtAll                    = 0x0002FFFD,                    /*The PrEvent Proc's CParam for the entire screen*/
  102.     lPrEvtTop                    = 0x0001FFFD,                    /*The PrEvent Proc's CParam for the top folder*/
  103.     iPrDrvrRef                    = -3
  104. };
  105.  
  106. enum {
  107.     getRslDataOp                = 4,
  108.     setRslOp                    = 5,
  109.     draftBitsOp                    = 6,
  110.     noDraftBitsOp                = 7,
  111.     getRotnOp                    = 8,
  112.     NoSuchRsl                    = 1,
  113.     OpNotImpl                    = 2,                            /*the driver doesn't support this opcode*/
  114.     RgType1                        = 1
  115. };
  116.  
  117. enum {
  118.     feedCut,
  119.     feedFanfold,
  120.     feedMechCut,
  121.     feedOther
  122. };
  123.  
  124. typedef SInt8 TFeed;
  125.  
  126.  
  127. enum {
  128.     scanTB,
  129.     scanBT,
  130.     scanLR,
  131.     scanRL
  132. };
  133.  
  134. typedef SInt8 TScan;
  135.  
  136. /* A Rect Ptr */
  137. typedef Rect *TPRect;
  138.  
  139. typedef pascal void (*PrIdleProcPtr)(void);
  140.  
  141. #if GENERATINGCFM
  142. typedef UniversalProcPtr PrIdleUPP;
  143. #else
  144. typedef PrIdleProcPtr PrIdleUPP;
  145. #endif
  146.  
  147. enum {
  148.     uppPrIdleProcInfo = kPascalStackBased
  149. };
  150.  
  151. #if GENERATINGCFM
  152. #define NewPrIdleProc(userRoutine)        \
  153.         (PrIdleUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppPrIdleProcInfo, GetCurrentArchitecture())
  154. #else
  155. #define NewPrIdleProc(userRoutine)        \
  156.         ((PrIdleUPP) (userRoutine))
  157. #endif
  158.  
  159. #if GENERATINGCFM
  160. #define CallPrIdleProc(userRoutine)        \
  161.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppPrIdleProcInfo)
  162. #else
  163. #define CallPrIdleProc(userRoutine)        \
  164.         (*(userRoutine))()
  165. #endif
  166.  
  167. typedef pascal void (*PItemProcPtr)(DialogPtr theDialog, short item);
  168.  
  169. #if GENERATINGCFM
  170. typedef UniversalProcPtr PItemUPP;
  171. #else
  172. typedef PItemProcPtr PItemUPP;
  173. #endif
  174.  
  175. enum {
  176.     uppPItemProcInfo = kPascalStackBased
  177.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DialogPtr)))
  178.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short)))
  179. };
  180.  
  181. #if GENERATINGCFM
  182. #define NewPItemProc(userRoutine)        \
  183.         (PItemUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppPItemProcInfo, GetCurrentArchitecture())
  184. #else
  185. #define NewPItemProc(userRoutine)        \
  186.         ((PItemUPP) (userRoutine))
  187. #endif
  188.  
  189. #if GENERATINGCFM
  190. #define CallPItemProc(userRoutine, theDialog, item)        \
  191.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppPItemProcInfo, (theDialog), (item))
  192. #else
  193. #define CallPItemProc(userRoutine, theDialog, item)        \
  194.         (*(userRoutine))((theDialog), (item))
  195. #endif
  196.  
  197. struct TPrPort {
  198.     GrafPort                        gPort;                        /*The Printer's graf port.*/
  199.     QDProcs                            gProcs;                        /*..and its procs*/
  200.     long                            lGParam1;                    /*16 bytes for private parameter storage.*/
  201.     long                            lGParam2;
  202.     long                            lGParam3;
  203.     long                            lGParam4;
  204.     Boolean                            fOurPtr;                    /*Whether the PrPort allocation was done by us.*/
  205.     Boolean                            fOurBits;                    /*Whether the BitMap allocation was done by us.*/
  206. };
  207. typedef struct TPrPort TPrPort, *TPPrPort;
  208.  
  209. /* Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
  210.   This is the "PrPeek" record. */
  211. struct TPrInfo {
  212.     short                            iDev;                        /*Font mgr/QuickDraw device code*/
  213.     short                            iVRes;                        /*Resolution of device, in device coordinates*/
  214.     short                            iHRes;                        /*..note: V before H => compatable with Point.*/
  215.     Rect                            rPage;                        /*The page (printable) rectangle in device coordinates.*/
  216. };
  217. typedef struct TPrInfo TPrInfo, *TPPrInfo;
  218.  
  219. /* Print Info Record: The parameters needed for page composition. */
  220. struct TPrStl {
  221.     short                            wDev;
  222.     short                            iPageV;
  223.     short                            iPageH;
  224.     SInt8                            bPort;
  225.     TFeed                            feed;
  226. };
  227. typedef struct TPrStl TPrStl, *TPPrStl;
  228.  
  229. struct TPrXInfo {
  230.     short                            iRowBytes;
  231.     short                            iBandV;
  232.     short                            iBandH;
  233.     short                            iDevBytes;
  234.     short                            iBands;
  235.     SInt8                            bPatScale;
  236.     SInt8                            bUlThick;
  237.     SInt8                            bUlOffset;
  238.     SInt8                            bUlShadow;
  239.     TScan                            scan;
  240.     SInt8                            bXInfoX;
  241. };
  242. typedef struct TPrXInfo TPrXInfo, *TPPrXInfo;
  243.  
  244. struct TPrJob {
  245.     short                            iFstPage;                    /*Page Range.*/
  246.     short                            iLstPage;
  247.     short                            iCopies;                    /*No. copies.*/
  248.     SInt8                            bJDocLoop;                    /*The Doc style: Draft, Spool, .., and ..*/
  249.     Boolean                            fFromUsr;                    /*Printing from an User's App (not PrApp) flag*/
  250.     PrIdleUPP                        pIdleProc;                    /*The Proc called while waiting on IO etc.*/
  251.     StringPtr                        pFileName;                    /*Spool File Name: NIL for default.*/
  252.     short                            iFileVol;                    /*Spool File vol, set to 0 initially*/
  253.     SInt8                            bFileVers;                    /*Spool File version, set to 0 initially*/
  254.     SInt8                            bJobX;                        /*An eXtra byte.*/
  255. };
  256. typedef struct TPrJob TPrJob, *TPPrJob;
  257.  
  258. /* Print Job: Print "form" for a single print request. */
  259. struct TPrint {
  260.     short                            iPrVersion;                    /*(2) Printing software version*/
  261.     TPrInfo                            prInfo;                        /*(14) the PrInfo data associated with the current style.*/
  262.     Rect                            rPaper;                        /*(8) The paper rectangle [offset from rPage]*/
  263.     TPrStl                            prStl;                        /*(8)  This print request's style.*/
  264.     TPrInfo                            prInfoPT;                    /*(14)  Print Time Imaging metrics*/
  265.     TPrXInfo                        prXInfo;                    /*(16)  Print-time (expanded) Print info record.*/
  266.     TPrJob                            prJob;                        /*(20) The Print Job request (82)  Total of the above; 120-82 = 38 bytes needed to fill 120*/
  267.     short                            printX[19];                    /*Spare to fill to 120 bytes!*/
  268. };
  269. typedef struct TPrint TPrint, *TPPrint, **THPrint;
  270.  
  271. /* The universal 120 byte printing record */
  272. struct TPrStatus {
  273.     short                            iTotPages;                    /*Total pages in Print File.*/
  274.     short                            iCurPage;                    /*Current page number*/
  275.     short                            iTotCopies;                    /*Total copies requested*/
  276.     short                            iCurCopy;                    /*Current copy number*/
  277.     short                            iTotBands;                    /*Total bands per page.*/
  278.     short                            iCurBand;                    /*Current band number*/
  279.     Boolean                            fPgDirty;                    /*True if current page has been written to.*/
  280.     Boolean                            fImaging;                    /*Set while in band's DrawPic call.*/
  281.     THPrint                            hPrint;                        /*Handle to the active Printer record*/
  282.     TPPrPort                        pPrPort;                    /*Ptr to the active PrPort*/
  283.     PicHandle                        hPic;                        /*Handle to the active Picture*/
  284. };
  285. typedef struct TPrStatus TPrStatus, *TPPrStatus;
  286.  
  287. /* Print Status: Print information during printing. */
  288. struct TPfPgDir {
  289.     short                            iPages;
  290.     long                            iPgPos[129];                /*ARRAY [0..iPfMaxPgs] OF LONGINT*/
  291. };
  292. typedef struct TPfPgDir TPfPgDir, *TPPfPgDir, **THPfPgDir;
  293.  
  294. /* PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!) */
  295. /* This is the Printing Dialog Record. Only used by folks appending their own
  296.    DITLs to the print dialogs.    Print Dialog: The Dialog Stream object. */
  297. #if STRICT_WINDOWS
  298. typedef struct OpaqueTPrDlgRef *TPPrDlgRef;
  299.  
  300. #else
  301. struct TPrDlg {
  302.     DialogRecord                    Dlg;                        /*The Dialog window*/
  303.     ModalFilterUPP                    pFltrProc;                    /*The Filter Proc.*/
  304.     PItemUPP                        pItemProc;                    /*The Item evaluating proc.*/
  305.     THPrint                            hPrintUsr;                    /*The user's print record.*/
  306.     Boolean                            fDoIt;
  307.     Boolean                            fDone;
  308.     long                            lUser1;                        /*Four longs for apps to hang global data.*/
  309.     long                            lUser2;                        /*Plus more stuff needed by the particular*/
  310.     long                            lUser3;                        /*printing dialog.*/
  311.     long                            lUser4;
  312. };
  313. typedef struct TPrDlg TPrDlg;
  314.  
  315. typedef TPrDlg *TPPrDlg;
  316.  
  317. typedef TPrDlg *TPPrDlgRef;
  318.  
  319. #endif
  320. typedef pascal TPPrDlgRef (*PDlgInitProcPtr)(THPrint hPrint);
  321.  
  322. #if GENERATINGCFM
  323. typedef UniversalProcPtr PDlgInitUPP;
  324. #else
  325. typedef PDlgInitProcPtr PDlgInitUPP;
  326. #endif
  327.  
  328. enum {
  329.     uppPDlgInitProcInfo = kPascalStackBased
  330.          | RESULT_SIZE(SIZE_CODE(sizeof(TPPrDlgRef)))
  331.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(THPrint)))
  332. };
  333.  
  334. #if GENERATINGCFM
  335. #define NewPDlgInitProc(userRoutine)        \
  336.         (PDlgInitUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppPDlgInitProcInfo, GetCurrentArchitecture())
  337. #else
  338. #define NewPDlgInitProc(userRoutine)        \
  339.         ((PDlgInitUPP) (userRoutine))
  340. #endif
  341.  
  342. #if GENERATINGCFM
  343. #define CallPDlgInitProc(userRoutine, hPrint)        \
  344.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppPDlgInitProcInfo, (hPrint))
  345. #else
  346. #define CallPDlgInitProc(userRoutine, hPrint)        \
  347.         (*(userRoutine))((hPrint))
  348. #endif
  349.  
  350. struct TGnlData {
  351.     short                            iOpCode;
  352.     short                            iError;
  353.     long                            lReserved;                    /*more fields here depending on call*/
  354. };
  355. typedef struct TGnlData TGnlData;
  356.  
  357. struct TRslRg {
  358.     short                            iMin;
  359.     short                            iMax;
  360. };
  361. typedef struct TRslRg TRslRg;
  362.  
  363. struct TRslRec {
  364.     short                            iXRsl;
  365.     short                            iYRsl;
  366. };
  367. typedef struct TRslRec TRslRec;
  368.  
  369. struct TGetRslBlk {
  370.     short                            iOpCode;
  371.     short                            iError;
  372.     long                            lReserved;
  373.     short                            iRgType;
  374.     TRslRg                            xRslRg;
  375.     TRslRg                            yRslRg;
  376.     short                            iRslRecCnt;
  377.     TRslRec                            rgRslRec[27];
  378. };
  379. typedef struct TGetRslBlk TGetRslBlk;
  380.  
  381. struct TSetRslBlk {
  382.     short                            iOpCode;
  383.     short                            iError;
  384.     long                            lReserved;
  385.     THPrint                            hPrint;
  386.     short                            iXRsl;
  387.     short                            iYRsl;
  388. };
  389. typedef struct TSetRslBlk TSetRslBlk;
  390.  
  391. struct TDftBitsBlk {
  392.     short                            iOpCode;
  393.     short                            iError;
  394.     long                            lReserved;
  395.     THPrint                            hPrint;
  396. };
  397. typedef struct TDftBitsBlk TDftBitsBlk;
  398.  
  399. struct TGetRotnBlk {
  400.     short                            iOpCode;
  401.     short                            iError;
  402.     long                            lReserved;
  403.     THPrint                            hPrint;
  404.     Boolean                            fLandscape;
  405.     SInt8                            bXtra;
  406. };
  407. typedef struct TGetRotnBlk TGetRotnBlk;
  408.  
  409. extern pascal void PrPurge(void)
  410.  FOURWORDINLINE(0x2F3C, 0xA800, 0x0000, 0xA8FD);
  411. extern pascal void PrNoPurge(void)
  412.  FOURWORDINLINE(0x2F3C, 0xB000, 0x0000, 0xA8FD);
  413. extern pascal void PrOpen(void)
  414.  FOURWORDINLINE(0x2F3C, 0xC800, 0x0000, 0xA8FD);
  415. extern pascal void PrClose(void)
  416.  FOURWORDINLINE(0x2F3C, 0xD000, 0x0000, 0xA8FD);
  417. extern pascal void PrintDefault(THPrint hPrint)
  418.  FOURWORDINLINE(0x2F3C, 0x2004, 0x0480, 0xA8FD);
  419. extern pascal Boolean PrValidate(THPrint hPrint)
  420.  FOURWORDINLINE(0x2F3C, 0x5204, 0x0498, 0xA8FD);
  421. extern pascal Boolean PrStlDialog(THPrint hPrint)
  422.  FOURWORDINLINE(0x2F3C, 0x2A04, 0x0484, 0xA8FD);
  423. extern pascal Boolean PrJobDialog(THPrint hPrint)
  424.  FOURWORDINLINE(0x2F3C, 0x3204, 0x0488, 0xA8FD);
  425. extern pascal TPPrDlgRef PrStlInit(THPrint hPrint)
  426.  FOURWORDINLINE(0x2F3C, 0x3C04, 0x040C, 0xA8FD);
  427. extern pascal TPPrDlgRef PrJobInit(THPrint hPrint)
  428.  FOURWORDINLINE(0x2F3C, 0x4404, 0x0410, 0xA8FD);
  429. extern pascal void PrJobMerge(THPrint hPrintSrc, THPrint hPrintDst)
  430.  FOURWORDINLINE(0x2F3C, 0x5804, 0x089C, 0xA8FD);
  431. extern pascal Boolean PrDlgMain(THPrint hPrint, PDlgInitUPP pDlgInit)
  432.  FOURWORDINLINE(0x2F3C, 0x4A04, 0x0894, 0xA8FD);
  433. extern pascal TPPrPort PrOpenDoc(THPrint hPrint, TPPrPort pPrPort, Ptr pIOBuf)
  434.  FOURWORDINLINE(0x2F3C, 0x0400, 0x0C00, 0xA8FD);
  435. extern pascal void PrCloseDoc(TPPrPort pPrPort)
  436.  FOURWORDINLINE(0x2F3C, 0x0800, 0x0484, 0xA8FD);
  437. extern pascal void PrOpenPage(TPPrPort pPrPort, TPRect pPageFrame)
  438.  FOURWORDINLINE(0x2F3C, 0x1000, 0x0808, 0xA8FD);
  439. extern pascal void PrClosePage(TPPrPort pPrPort)
  440.  FOURWORDINLINE(0x2F3C, 0x1800, 0x040C, 0xA8FD);
  441. extern pascal void PrPicFile(THPrint hPrint, TPPrPort pPrPort, Ptr pIOBuf, Ptr pDevBuf, TPrStatus *prStatus)
  442.  FOURWORDINLINE(0x2F3C, 0x6005, 0x1480, 0xA8FD);
  443. extern pascal short PrError(void)
  444.  FOURWORDINLINE(0x2F3C, 0xBA00, 0x0000, 0xA8FD);
  445. extern pascal void PrSetError(short iErr)
  446.  FOURWORDINLINE(0x2F3C, 0xC000, 0x0200, 0xA8FD);
  447. extern pascal void PrGeneral(Ptr pData)
  448.  FOURWORDINLINE(0x2F3C, 0x7007, 0x0480, 0xA8FD);
  449. extern pascal void PrDrvrOpen(void)
  450.  FOURWORDINLINE(0x2F3C, 0x8000, 0x0000, 0xA8FD);
  451. extern pascal void PrDrvrClose(void)
  452.  FOURWORDINLINE(0x2F3C, 0x8800, 0x0000, 0xA8FD);
  453. extern pascal void PrCtlCall(short iWhichCtl, long lParam1, long lParam2, long lParam3)
  454.  FOURWORDINLINE(0x2F3C, 0xA000, 0x0E00, 0xA8FD);
  455. extern pascal Handle PrDrvrDCE(void)
  456.  FOURWORDINLINE(0x2F3C, 0x9400, 0x0000, 0xA8FD);
  457. extern pascal short PrDrvrVers(void)
  458.  FOURWORDINLINE(0x2F3C, 0x9A00, 0x0000, 0xA8FD);
  459.  
  460. #if PRAGMA_IMPORT_SUPPORTED
  461. #pragma import off
  462. #endif
  463.  
  464. #if PRAGMA_ALIGN_SUPPORTED
  465. #pragma options align=reset
  466. #endif
  467.  
  468. #ifdef __cplusplus
  469. }
  470. #endif
  471.  
  472. #endif /* __PRINTING__ */
  473.